package Cam3zyx0712;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

public class ImageBoard  extends JFrame {
    private DrawMouse dl=null;

    public void initUI() {
        //窗体的创建
        this.setTitle("美颜相机v0.1--by zyx");
        this.setSize(1000, 750);
        this.getContentPane().setBackground(Color.WHITE);
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo(null);
        this.setLayout(new BorderLayout());

        //按钮面板  对象JPanel  默认是流式布局
        JPanel northPanel = new JPanel();
        northPanel.setBackground(Color.PINK);
        northPanel.setPreferredSize(new Dimension(0,30));
        this.add(northPanel,BorderLayout.NORTH);

        //图画面板
        JPanel drawPanel = new JPanel();
        drawPanel.setBackground(Color.WHITE);
        this.add(drawPanel,BorderLayout.CENTER);

        this.setVisible(true);

        Graphics g=drawPanel.getGraphics();

        //按钮键->按钮功能(动作监听器)
        String[] strs={"原图","二值化","灰度","马赛克","放大"};
        DrawMouse mouse = new DrawMouse(g);
        for(int i=0;i< strs.length;i++) {
            JButton buDraw = new JButton(strs[i]);
            northPanel.add(buDraw);
            buDraw.addActionListener(mouse);
        }

        this.setVisible(true);
    }




    public static void main(String[] args) {
        new ImageBoard().initUI();
    }

}
